package com.ruoqing.utils.common;

import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

/**
	* @author YaoXian
	* @title: Md5Encryption
	* @projectName ruoxi-blog
	* @description: 若兮微服务 - 通用工具类 - MD5算法加密工具类
	* @date 2020-11-14 22:47
	*/
public class  Md5Encryption {
		/**
			* MD5算法加密
			* @param password
			* @return String
			* @throws RuntimeException
			*/
		public static String encryption(String password) throws RuntimeException {
				if (password != null) {
						return DigestUtils.md5DigestAsHex(password.getBytes());
				} else {
						throw new RuntimeException("密码为空!");
				}
		}
}
